/**
 * @file 2dArray.c
 * @author liuzhilai (you@domain.com)
 * @brief 二维数组的初始化
 * @version 0.1
 * @date 2022-11-06
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#include<stdio.h>
int main(){
    int array[3][4]={{1,3,-1,0},{2,-1,2,-1},{0,1,2,1}};
    /// @brief 打印矩阵主对角线
    /// @return 
    int idx;
    int max;
    for(idx=0;idx<3;idx++){
        printf("%d ",array[idx][idx]);
    }
    printf("\n");
    /// @brief 访问矩阵的副对角线
    /// @return 
    for(idx=0;idx<3;idx++){
        printf("%d ",array[idx][3-idx]);
    }
    /// @brief 打印整个矩阵中的最大值
    // 打擂台
    /// @return 
    max = array[0][0];
    int i,j;
    int maxi=0,maxj=0;
    for(i=0;i<3;i++){
        for(j=0;j<4;j++){
            if(max<array[i][j]){
                max = array[i][j];
                maxi = i;
                maxj = j;
            }
            // max = max<array[i][j]?array[i][j]:max;
            // maxi = i;
            // maxj = j;
        }
    }

    printf("\nThe max is %d, in row%d and col%d ",max,maxi+1,maxj+1);
    /// @brief 求矩阵每一行的和
    /// @return 
    int sum[3];
    return 0;
}